﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using LightWeb.Infrastructure.Repositories;

namespace LightWeb.MvcWeb.Controllers
{
    public class HomeController : Controller
    {
        public ActionResult Index()
        {
            ViewBag.Message = "Welcome to ASP.NET MVC!";
            DataContext context = new DataContext();
            var postList = context.Read<DomainModel.Post>(null, null);
            ViewBag.PostList = postList;
            return View();
        }
        [Authorize]
        public ActionResult About()
        {
            return View();
        }

        public ActionResult Details(Guid id)
        {
            DataContext context = new DataContext();
            var post = context.FindByProperty<DomainModel.Post>("PostID", id);
            //post.Content = "<table><tr><td>Table Test</td><td>Table Test</td><td>Table Test</td><td>Table Test</td><td>Table Test</td></tr><tr><td>Table Test</td><td>Table Test</td><td>Table Test</td><td>Table Test</td><td>Table Test</td></tr><tr><td>Table Test</td><td>Table Test</td><td>Table Test</td><td>Table Test</td><td>Table Test</td></tr></table>";
            return View(post);
        }
    }
}
